package com.ruoyi.cngj.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.IdWorker;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.cngj.mapper.CngjProjectMapper;
import com.ruoyi.cngj.domain.CngjProject;
import com.ruoyi.cngj.service.ICngjProjectService;
import com.ruoyi.common.core.text.Convert;

/**
 * 项目案例Service业务层处理
 * 
 * @author yuexl
 * @date 2024-06-27
 */
@Service
public class CngjProjectServiceImpl implements ICngjProjectService 
{
    @Autowired
    private CngjProjectMapper cngjProjectMapper;

    /**
     * 查询项目案例
     * 
     * @param id 项目案例ID
     * @return 项目案例
     */
    @Override
    public CngjProject selectCngjProjectById(String id)
    {
        return cngjProjectMapper.selectCngjProjectById(id);
    }

    /**
     * 查询项目案例列表
     * 
     * @param cngjProject 项目案例
     * @return 项目案例
     */
    @Override
    public List<CngjProject> selectCngjProjectList(CngjProject cngjProject)
    {
        return cngjProjectMapper.selectCngjProjectList(cngjProject);
    }

    /**
     * 新增项目案例
     * 
     * @param cngjProject 项目案例
     * @return 结果
     */
    @Override
    public int insertCngjProject(CngjProject cngjProject)
    {
        cngjProject.setId(IdWorker.getId());
        cngjProject.setCreateTime(DateUtils.getNowDate());
        return cngjProjectMapper.insertCngjProject(cngjProject);
    }

    /**
     * 修改项目案例
     * 
     * @param cngjProject 项目案例
     * @return 结果
     */
    @Override
    public int updateCngjProject(CngjProject cngjProject)
    {
        cngjProject.setUpdateTime(DateUtils.getNowDate());
        return cngjProjectMapper.updateCngjProject(cngjProject);
    }

    /**
     * 删除项目案例对象
     * 
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deleteCngjProjectByIds(String ids)
    {
        return cngjProjectMapper.deleteCngjProjectByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除项目案例信息
     * 
     * @param id 项目案例ID
     * @return 结果
     */
    @Override
    public int deleteCngjProjectById(String id)
    {
        return cngjProjectMapper.deleteCngjProjectById(id);
    }
}
